<script lang="ts" setup>
import { AuthenticationLogin } from '@vben/common-ui';

import { useAuthStore } from '#/store';
import { reactive, ref, onMounted, h, computed} from 'vue';
import { uctoo_wechatopen, uctoo_wechatpay_transaction, uctoo_minishop_order } from '#/store';
import type { MinishopOrder, MinishopOrderResponse } from '../minishop_order/types.ts';
import { useRepo } from 'pinia-orm';
import { useAxiosRepo } from '@pinia-orm/axios';
import { useRoute } from 'vue-router';
import { message , Modal} from 'ant-design-vue';
import { $t } from '@vben/locales';
import { WechatJssdk } from '@hairy/wechat-jssdk';
// 获取当前路由信息
const route = useRoute();
// 获取查询字符串部分
let queryParams = reactive({ ...route.query });
defineOptions({ name: 'UnipayWechatJSSDK' });

interface WxPayParams {
  timestamp: number;    // 支付签名时间戳
  nonceStr: string;     // 支付签名随机串
  package: string;      // 统一下单接口返回的 prepay_id
  signType: "MD5"|"HMAC-SHA256"; // 签名方式
  paySign: string;      // 支付签名
}
const currentRecord = ref<MinishopOrder | null>(null);
const authStore = useAuthStore();
const showVerifyCode = ref(true);
const minishopOrderRepo = computed(() => {
  return useRepo(uctoo_minishop_order)
});

onMounted(async () => {
  const historyParams = history.state;
console.log(historyParams);
 if(historyParams.params?.id){
  //从路由中获取订单号，查询订单数据
  const orderData = await useAxiosRepo(uctoo_minishop_order).api().getuctooMinishopOrder(historyParams.params?.id); //返回值自动更新models中订单数据
  
  //获取订单数据
  const res = minishopOrderRepo.value
    .query()
    .where('id',String(historyParams.params.id))
    .first();
  console.log('res', res); 
  currentRecord.value = res as unknown as MinishopOrder;
 }
});
</script>

<template>
  <div>
            <!--  <h2>{{$t('database_column.minishop_order.out_order_id')}}:{{ currentRecord?.out_order_id }}</h2>-->
              <h3>支付成功</h3>
            </div>
</template>
